﻿@namespace Blazorise.Docs.Docs.Examples
@using Blazorise.Docs.Models

<DataGrid TItem="Employee"
          Data="@employeeList"
          Editable
          EditMode="DataGridEditMode.Inline"
          Responsive>
    <DataGridCommandColumn TItem="Employee"></DataGridCommandColumn>
    <DataGridColumn TItem="Employee" Field="@nameof( Employee.Salary )" Caption="Salary" DisplayFormat="{0:C}" DisplayFormatProvider="@System.Globalization.CultureInfo.GetCultureInfo("fr-FR")" Editable="true">
        <EditTemplate>
            <NumericEdit TValue="decimal"
                         Value="@((decimal)context.CellValue)"
                         ValueChanged="@( v => {
                            context.CellValue = v;
                            context.UpdateCell( nameof( Employee.Tax ), v * .25m );
                         })" />
        </EditTemplate>
    </DataGridColumn>
    <DataGridColumn TItem="Employee" Field="@nameof( Employee.Tax )" Caption="Tax" Editable="true" />
</DataGrid>

@code{
    private List<Employee> employeeList = EmployeeData.EmployeeList;
}